<template>
  <div class="public_main">
    <div class="crumbs">
      <el-breadcrumb separator="/">
        <el-breadcrumb-item>{{$t('dashBoard.no2')}}</el-breadcrumb-item>
        <el-breadcrumb-item>{{$t('dashBoard.no6')}}</el-breadcrumb-item>
      </el-breadcrumb>
    </div>

    <!-- -------------搜索查询栏------------------------ -->
    <search 
      :searchData="searchData" 
      @search="search" 
      :searchRight="true"
      
    ></search>
    <!-- :outputRight="$store.state.common.permiss.includes('RIGHT_ACCOUNT_LENDING_EXP')" -->

    <!-- -------------表格数据开始------------------------ -->
    <!-- <div class="table" v-if="$store.state.common.permiss.includes('RIGHT_ACCOUNT_LENDING_LIST')"> -->
    <div class="table">
      <el-table :data="tableData" stripe size="small" >
        <el-table-column align="center" prop="orderNo" :label="$t('public.no33')"></el-table-column>
        <el-table-column align="center" prop="orderNo" :label="$t('merchantList.no8')"></el-table-column>
        <el-table-column align="center" prop="orderId" :label="$t('merchantList.no1')"></el-table-column>
        <el-table-column align="center" prop="userId" :label="$t('new.no49')"></el-table-column>
        <el-table-column align="center" prop="transactionId" :label="$t('merchantList.no52')"></el-table-column>
        <el-table-column align="center" prop="userName" :label="$t('merchantList.no53')"></el-table-column>
        <el-table-column align="center" prop="loanType" :label="$t('merchantList.no54')"></el-table-column>
        <el-table-column fixed="right" align="center" prop="operation" :label="$t('public.operation')" min-width="180">
          <template slot-scope="scope" >
            <!-- 查看明细 -->
            <span class="table_opr" @click="showDetail(scope.row.id)">{{$t('merchantList.no55')}}</span>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <!-- ------------  分页显示栏  ------------------------ -->
    <el-row type="flex" justify="end">
      <div class="pages" >
        <el-pagination
          @current-change="handleCurrentChange"
          :current-page="pagination.current"
          layout="sizes, prev, pager, next, total,->"
          :page-sizes="pagination.pageSizeOptions"
          :page-size="pagination.pageSize"
          @size-change="handleSizeChange"
          :total="pagination.total">
        </el-pagination>
      </div>
    </el-row>

    <div class="foot"></div>

    <!-- ------------------ 查看明细弹窗 -------------------- -->
    <el-dialog :title="$t('merchantList.no55')" :visible.sync="changeFlag" width="80%">
      <el-table :data="detailTableData" stripe size="small" >
        <el-table-column align="center" prop="orderNo" :label="$t('public.orderNo')"></el-table-column>
          <el-table-column align="center" prop="orderId" :label="$t('public.orderId')"></el-table-column>
          <el-table-column align="center" prop="userId" :label="$t('public.userId')"></el-table-column>
          <el-table-column align="center" prop="transactionId" :label="$t('finance.dealId')"></el-table-column>
          <el-table-column align="center" prop="userName" :label="$t('public.name')"></el-table-column>
          <el-table-column align="center" prop="loanType" :label="$t('finance.putMoneyType')">
            <template slot-scope="scope"><span>{{scope.row.loanType==1?$t('finance.putType.no1'):$t('finance.putType.no2')}}</span></template>
          </el-table-column>
          <el-table-column align="center" prop="phone" :label="$t('public.no18')"></el-table-column>
          <el-table-column align="center" prop="amount" :label="$t('finance.amount')">
            <template slot-scope="scope"><span>{{$store.state.common.id_currency}}{{$store.getters.moneySplit(scope.row.amount)}}{{$store.state.common.vi_currency}}</span></template>
          </el-table-column>
          <el-table-column align="center" prop="strApplyTime" :label="$t('public.CreateDate')" width="86"></el-table-column>
          <el-table-column align="center" prop="strLoanTime" :label="$t('finance.successDate')" width="86"></el-table-column>
          <el-table-column align="center" prop="thirdChannel" :label="$t('finance.channel')"></el-table-column>
          <el-table-column align="center" prop="bankType" :label="$t('yuenan.no18')"></el-table-column>
          <el-table-column align="center" prop="bankName" :label="$t('public.no19')">
            <template slot-scope="scope">
              <span v-if="scope.row.bankType!==null&&scope.row.bankType!==undefined&&scope.row.bankType==='NganLuong'">-</span>
              <span v-else>{{scope.row.bankName}}</span>
            </template>
          </el-table-column>
          <el-table-column align="center" prop="email" :label="$t('finance.account')">
            <template slot-scope="scope">
              <span v-if="scope.row.bankType!==null&&scope.row.bankType!==undefined&&scope.row.bankType==='NganLuong'">{{scope.row.email}}</span>
              <span v-else>{{scope.row.bankAccount}}</span>
            </template>
          </el-table-column>
          <el-table-column align="center" prop="status" :label="$t('finance.status')">
            <template slot-scope="scope"><span>{{$t($store.getters.putMoneyLogStatus(scope.row.status))}}</span></template>
          </el-table-column>
          <el-table-column align="center" prop="status" :label="$t('finance.status')"></el-table-column>
          <el-table-column align="center" prop="status" label="APK"></el-table-column>
          <el-table-column align="center" prop="remark" :label="$t('public.no37')"></el-table-column>
      </el-table>
    </el-dialog>

  </div>
</template>
<script>
export default {
  name: 'merchantListConsumeData',
  data () {
    const searchData=[
      {
        type: 'input',
        label: 'merchantList.no1',
        attr: 'orderNo',
        value: ''
      },{
        type: 'rangePicker',
        label: 'public.no33',
        attr: 'searchTime1',
        value: [],
      }
    ]
    return {
      flag: true,
      loadFlag: true,
      detailFlag: true,
      token: sessionStorage.getItem('accToken'),
      pagination: {
        pageSize: global.config.pageSize,
        pageSizeOptions: global.config.pageSizeOptions,
        current: 1,
        total: 0,
      },
      searchData:searchData,
      formInline: {},// 用户查询信息数据对应字段
      tableData: [],// 表格数据
      detailTableData: []
    }
  },
  methods: {
    handleSizeChange (val) {// 每页条数变化时操作
      this.pagination.pageSize = val;
      this.getTableData();
    },
    handleCurrentChange (val) { // 分页按钮点击操作
      this.pagination.current = val;
      this.getTableData();
    },
    search(search) { // 搜索
      this.formInline = {
        transactionId: search.transactionId,
        orderNo:search.orderNo,
        orderId: search.orderId,
        userName:search.userName,
        phone: search.phone,
        thirdChannel: search.thirdChannel,
        applyTimeBegin: search.searchTime1?search.searchTime1[0]:'',
        applyTimeEnd: search.searchTime1?search.searchTime1[1]:'',
        status: search.status,
        loanType:search.loanType,
        thirdChannel:search.thirdChannel
      };
      this.pagination.current = 1;
      this.getTableData();
    },
    getTableData () { // 列表数据获取
      this.loadFlag = true;
      let option = {
        pageNum:this.pagination.current,
        pageSize:this.pagination.pageSize,
        param: {
          partnerId:sessionStorage.partnerId,
          ...this.formInline
        }       
      }
      this.$axios.post(this.$action.finance_loanlist, option).then(res => {
        this.flag = true;
        if (res.data.code == 200) {
          this.tableData = res.data.data.list;
          this.pagination.total = res.data.data.total;
        }else{
          this.$globalMsg.error(res.data.message)
        }
        this.loadFlag = false;
      })
    },
    showDetail() {
      this.detailFlag = true
    },
  },
  mounted () {
    // this.getTableData();
  }
}
</script>
<style scoped lang="scss">

</style>
